/**
 * FileName: Json
 * Author:   lvyabin
 * Date:     2018/11/25 2:57 AM
 * Description: 请求返回的方法类型使用此类
 * History:
 * <author>          <time>          <version>          <desc>
 * 作者姓名           修改时间           版本号              描述
 */
package com.xly.util;

/** 
* @author Your-Name: Carey
* @version Create-Date：2020年3月11日 下午3:24:56 
* Class Description:
*/
public class JsonUtil {
	//信息
	private String msg;
	//状态值  true/false
	private boolean suc;
	//结果集
	private Object result;

	//构造方法
	public JsonUtil() {
	}
	public JsonUtil(Object result) {
		this.result = result;
	}
	public JsonUtil(String msg) {
		this.msg = msg;
	}
	public JsonUtil(String msg, Object result) {
		this.msg = msg;
		this.result = result;
	}
	public JsonUtil(String msg,  boolean suc, Object result) {
		this.msg = msg;
		this.result = result;
		this.suc = suc;
	}


	/**
	 * 成功结果
	 */
	public static JsonUtil success(Object result) {
		return new JsonUtil("ok", true, result );
	}

	/**
	 * 失败结果
	 */
	public static JsonUtil fail(String msg) {
		return new JsonUtil("fail", false, null);
	}

	/**
	 * 自定义结果
	 */
	public static JsonUtil rs(String msg, Object result, boolean suc) {
		return new JsonUtil(msg, suc, result);
	}

	public String getMsg() {
		return msg;
	}

	public void setMsg(String msg) {
		this.msg = msg;
	}

	public boolean isSuc() {
		return suc;
	}

	public void setSuc(boolean suc) {
		this.suc = suc;
	}

	public Object getResult() {
		return result;
	}

	public void setResult(Object result) {
		this.result = result;
	}

}